<template>
  <div class="contain">
    <header>
      <div class="returns" @click="goBack()">
        <i class="iconfont icon-fanhui"></i>
      </div>
      <div class="go-home">
        <img src="@/assets/images/home.png" alt="" />
      </div>
    </header>

    <div class="main" v-for="Object in cateList" :key="Object.id">
      <router-link :to="'/detail/' + Object.id">
        <div class="my-goods-item">
          <div class="left">
            <label class="custom-control-label" :for="Object.id">
              <img :src="Object.imgUrl" alt="" />
            </label>
          </div>
          <div class="right">
            <div class="top">{{ Object.name }}</div>
            <div class="bottom">
              <span class="price">¥ {{ Object.price }}</span>
              <span class="pay"> {{ Object.sum }}+ 人付款</span>
            </div>
          </div>
        </div>
      </router-link>
    </div>

    <div class="floot">
      <div class="line-l"></div>
      <span>店铺信息</span>
      <div class="line-r"></div>
      <img src="../../public/images/底部.jpg" alt="" />
    </div>
  </div>
</template>

<script>
import http from "@/common/api/request.js";
export default {
  data() {
    return {
      cateList: [],
    };
  },
  created() {
    this.goodsCate();
  },

  watch: {
    $route(to, from) {
      if (this.$route.params.id) {
        this.goodsCate();
      }
    },
  },

  methods: {
    //   获取商品分类的分类
    async goodsCate() {
      let res = await http.$axios({
        url: "http://127.0.0.1:3008/goods/goodscate/" + this.$route.params.id,
      });
      this.cateList = res
    },

    // 返回上一级
    goBack() {
      this.$router.go(-1);
    },

  },
};
</script>

<style scoped lang="scss">
a{
    color: #454545;
    text-decoration: none;
}
.contain {
  margin-bottom: 20px;
  font-family: STFangsong;
  letter-spacing: 1px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;

  background-color: #b0352f;
  .returns {
    line-height: 1.173333rem;
    padding: 0 0.533333rem;
    i {
      color: #fff;
      font-size: 0.693333rem;
    }
  }
  .go-home {
    padding: 0 0.266666rem;
    line-height: 1.173333rem;
    img {
      width: 35px;
      height: 35px;
      margin-top: 9px;
    }
  }
}

.main {
  padding-top: 22px;
  background-color: #fff;

  .my-goods-item {
    display: flex;
    padding: 10px;

    .left {
      img {
            width: 132px;
    height: 160px;
    margin-right: 8px;
    margin-left: 20px;
    margin-top: -12px;
      }
      .custom-control-label::before,
      .custom-control-label::after {
        top: 50px;
      }
    }
    .right {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      .top {
        font-size: 15px;
        font-weight: 500;
        margin-left: 13px;
      }
      .bottom {
        display: flex;
        justify-content: space-between;
        padding: 5px 0;
        align-items: center;
        .price {
          color: #fd3f31;
          font-weight: bold;
          font-size: 17px;
          margin-left: 13px;
        }
        .pay {
          color: #8b8b8b;
          font-size: 13px;
          margin-right: 11px;
        }
      }
    }
  }
}
.floot {
  font-size: 20px;
  text-align: center;
  margin-top: 62px;

  .line-l,
  .line-r {
    width: 104px;
    height: 1px;
    background-color: #d5d5d5;
    margin-bottom: -17px;
  }
  .line-l {
    margin-left: 13px;
  }
  span {
    color: black;
  }
  .line-r {
    margin-left: 276px;
    margin-top: -13px;
  }
  img {
    vertical-align: middle;
    width: 200px;
    margin-top: 37px;
  }
}
</style>
